﻿Imports System.IO

Public Class Data
    Private Shared strClaveIni As String = Aplication.Passwords.PasswordIni
    Private Shared blnConexionWeb As Boolean = False
    Private Shared strConexionIni As String = ""
    Public Shared Property ConexionWeb() As Boolean
        Get
            Return blnConexionWeb
        End Get
        Set(ByVal value As Boolean)
            blnConexionWeb = value
        End Set
    End Property
    Public Shared Property ConexionIni() As String
        Get
            If ConexionWeb = True Then
                Return strConexionIni
            Else
                Return SqlIni()
            End If
        End Get
        Set(ByVal value As String)
            strConexionIni = value
        End Set
    End Property
    Private Shared Function SqlIni() As String
        Return ""

        'Dim objReader As New StreamReader(Path.ConfigIni.CN)
        'Dim sLine As String = ""
        'Dim arrText As New ArrayList
        'Do
        '    sLine = objReader.ReadLine()
        '    If Not sLine Is Nothing Then
        '        arrText.Add(sLine)
        '    End If
        'Loop Until sLine Is Nothing
        'objReader.Close()

        'Dim strServerName As String = Vichama.Components.Cifrado.DesencriptarTexto(arrText.Item(1).ToString, strClaveIni)
        'Dim strDBName As String = Vichama.Components.Cifrado.DesencriptarTexto(arrText.Item(2).ToString, strClaveIni) '""
        'Dim strUserName As String = Vichama.Components.Cifrado.DesencriptarTexto(arrText.Item(3).ToString, strClaveIni)
        'Dim strUserPassword As String = Vichama.Components.Cifrado.DesencriptarTexto(arrText.Item(4).ToString, strClaveIni)

        'Dim sqlCon As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection( _
        '    "server=" & strServerName & _
        '    "; database=" & strDBName & _
        '    "; uid=" & strUserName & _
        '    "; pwd=" & strUserPassword & ";")

        'Dim strConexion As New Text.StringBuilder

        'strConexion.Append("server=")
        'strConexion.Append(strServerName)
        'strConexion.Append("; ")
        'strConexion.Append("database=")
        'strConexion.Append(strDBName)
        'strConexion.Append("; ")
        'strConexion.Append("uid=")
        'strConexion.Append(strUserName)
        'strConexion.Append("; ")
        'strConexion.Append("pwd=")
        'strConexion.Append(strUserPassword)
        'strConexion.Append("; ")

        'Return strConexion.ToString()

    End Function
    '#Region "Propiedades_CN"
    '    Public Shared ReadOnly Property CNTipo() As String
    '        Get
    '            Dim value As String = ""
    '            value = Vichama.Components.Cadena.LeerLineaArchivo(Path.ConfigIni.CN, 1)
    '            Return Vichama.Components.Cifrado.DesencriptarTexto(value, strClaveIni)
    '        End Get
    '    End Property
    '    Public Shared ReadOnly Property CNServer() As String
    '        Get
    '            Dim value As String = ""
    '            value = Vichama.Components.Cadena.LeerLineaArchivo(Path.ConfigIni.CN, 2)
    '            Return Vichama.Components.Cifrado.DesencriptarTexto(value, strClaveIni)
    '        End Get
    '    End Property
    '    Public Shared ReadOnly Property CNDataBase() As String
    '        Get
    '            Dim value As String = ""
    '            value = Vichama.Components.Cadena.LeerLineaArchivo(Path.ConfigIni.CN, 3)
    '            Return Vichama.Components.Cifrado.DesencriptarTexto(value, strClaveIni)
    '        End Get
    '    End Property
    '    Public Shared ReadOnly Property CNUser() As String
    '        Get
    '            Dim value As String = ""
    '            value = Vichama.Components.Cadena.LeerLineaArchivo(Path.ConfigIni.CN, 4)
    '            Return Vichama.Components.Cifrado.DesencriptarTexto(value, strClaveIni)
    '        End Get
    '    End Property
    '    Public Shared ReadOnly Property CNPass() As String
    '        Get
    '            Dim value As String = ""
    '            value = Vichama.Components.Cadena.LeerLineaArchivo(Path.ConfigIni.CN, 5)
    '            Return Vichama.Components.Cifrado.DesencriptarTexto(value, strClaveIni)
    '        End Get
    '    End Property
    '#End Region
End Class